// pages/more-movie/more-movie.js
let api = require('../../utils/api.js');
let resultData = require('../../utils/data.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
moreData:[],
page:1
  },

  getData() {
    let page = this.data.page
    wx.showLoading({
      title: '加载中。。。',
    })
    api.getData('/onebox/movie/pmovie', 'get', {
      key: 'a8b932b7661aee98fcb3c89984626302',
      city: '杭州'
    }).then(res => {
      console.log(res)
      wx.hideLoading()
    }, err => {
      console.log(err)
    });
    // wx.request({
    //   url: 'url',
    //   method:'get',
    //   data:{
    //     page:page
    //   },
    //   success:function(res) {
    //     console.log(res.data);
    //   }
    // })
  },

  loadMore() {
let movieList = this.data.moreData
// let page = this.data.page
// page++
// this.getData()
this.setData({
  moreData:movieList.concat(resultData.moreData)
})
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.setData({
moreData:resultData.moreData
    })
    this.getData()
wx.setNavigationBarTitle({
  title: options.title,
})
wx.setNavigationBarColor({
  backgroundColor: '#87080B',
  frontColor: '#ffffff',
})
wx.showNavigationBarLoading()
setTimeout(wx.hideNavigationBarLoading,1000)
},

})